<?php 
/*
 * page to list projects.  datagrid is included asynchronously
*/
//check for a valid session
include("../inc_files/utils/checkadmin.php");
//include the page header
include("../inc_files/ui/header.php");?>
<title>Projects</title>
<script type="text/javascript" src="../scripts/async.js"></script>
<script type='text/javascript'>

//async refresh of projects datagrid
function refreshgrid(){
	var nochache = Math.floor(Math.random() * 10000);
	getasync('a_listprojects.php?&nocache=' +
			 nochache,'datagrid', true);		
}

function deleteproject(projectid){
//confirm deletion with user
if(confirm("Are you sure you want to mark project " + projectid + " as deleted?"))
	{
		//create a new task then refresh the data grid with new data
		alert(postasync('a_deleteproject.php','value','projectid='+projectid, false) + " project marked as deleted");
		refreshgrid();
	}
}

</script>
</head>
<body>
	<?php

	//add the navigation to the page
	include($_SERVER['DOCUMENT_ROOT']."/f21na/inc_files/ui/menu.php");?>
	<!-- add a div tag to display the list of users using AJAX -->
	<div id="datagrid"></div>
	<?php
	//add the page footer
	include($_SERVER['DOCUMENT_ROOT']."/f21na/inc_files/ui/footer.php");?>
	<script type="text/javascript">	
	//populate the datagrid on page load
	refreshgrid();	
	</script>
</body>
</html>
